package sbc.group1.lab1.alt;

import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import org.mozartspaces.core.MzsCoreException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CountFinishedCars {
    private static final Logger log = LoggerFactory.getLogger(CountFinishedCars.class);
    private CarService cs;
    
    public static void main(String args[]) throws MalformedURLException, MzsCoreException, URISyntaxException, RemoteException, NotBoundException {
        new CountFinishedCars().run();
    }
    
    public CountFinishedCars() throws MalformedURLException, RemoteException, NotBoundException {
        cs= (CarService)
            Naming.lookup("rmi://localhost:1099/CarService");
    }
    
    public void run() throws RemoteException {
        log.info("Cars finished: " + 
                Integer.toString(cs.getNumFinishedCars()
                        ));
    }
}
